﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Classified.Domain.Entities
{
    public class ClassifiedAd
    {
        [Key]
        [HiddenInput(DisplayValue = false)]
        public int Id { get; set; }

        [Required]
        public string Title { get; set; }

        [Display(Name = "Meta Description ")]
        public string MetaDesc { get; set; }

        [Display(Name = "Meta Title ")]
        public string MetaTitle { get; set; }
        [Display(Name = "Meta KeyWords ")]
        public string MetaKeyWord { get; set; }
        [Display(Name = "Short Descriptions ")]
        public string ShortDescription { get; set; }


        [Display(Name = "Descriptions ")]

        public string Description { get; set; }

        [Required]
        [Display(Name = "Address ")]
        public string Address { get; set; }

        [Display(Name = "Phone Number ")]
        public string PhoneNumber { get; set; }

        [Display(Name = "Is Active")]
        public bool IsActive { get; set; }

        [Display(Name = "Submit Date")]
        public DateTime SubmitDate { get; set; }



        [Display(Name = "Created On Utc")]
        public DateTime CreatedOnUtc { get; set; }

        [Display(Name = "Updated On Utc")]
        public DateTime? UpdatedOnUtc { get; set; }

        [Required(ErrorMessage = "EmailID is required")]
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter a valid e-mail adress")]
        [DataType(DataType.EmailAddress)]
        [MaxLength(200)]
        public string EmailID { get; set; }

        public bool Deleted { get; set; }

        [Display(Name = "Price ")]
       public decimal Price { get; set; }

        [Display(Name = "Is Featured")]
        public bool IsEnhanced { get; set; }

        public int CategoryId { get; set; }

        [ForeignKey("CategoryId")]
        public virtual ClassifiedCategory ClassifiedCategories { get; set; }

        public virtual ICollection<ClassifiedPicture> ClassifiedPicture { get; set; }
        public virtual ICollection<Location> Locations { get; set; }
        public virtual ICollection<ClassifiedComment> ClassifiedComments { get; set; }
        public virtual ICollection<User> Users { get; set; }
        public virtual ICollection<AttributeValue> AttributeValues { get; set; }
       
            [NotMapped]
        public int LocationId { get; set; }


    }

    public class ClassifiedComment
    {
        [Key]
        public int Id { get; set; }
        [Required]
        public string Name { get; set; }
        [Required(ErrorMessage = "Email is required")]
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter a valid e-mail adress")]
        [DataType(DataType.EmailAddress)]
        [MaxLength(200)]
        public string Email { get; set; }
        public string Comment { get; set; }
        public int ClassifiedId { get; set; }
        public DateTime CreateDate { get; set; }
        [ForeignKey("ClassifiedId")]
        public virtual ClassifiedAd ClassifiedAds { get; set; }

    }

}